import { createRouter, createWebHistory } from 'vue-router';

const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      redirect: '/workflow',
    },
    {
      path: '/workflow',
      name: 'WorkflowDashboard',
      component: () => import('../views/category/index.vue'),
      meta: {
        title: '工作流管理',
        keepAlive: true,
      },
    },
    {
      path: '/workflow/category',
      name: 'WorkflowCategory',
      component: () => import('../views/category/index.vue'),
      meta: {
        title: '流程分类',
        keepAlive: true,
      },
    },
    {
      path: '/workflow/definition',
      name: 'ProcessDefinition',
      component: () => import('../views/processDefinition/index.vue'),
      meta: {
        title: '流程定义',
        keepAlive: true,
      },
    },
    {
      path: '/workflow/instance',
      name: 'ProcessInstance',
      component: () => import('../views/processInstance/index.vue'),
      meta: {
        title: '流程实例',
        keepAlive: true,
      },
    },
    {
      path: '/workflow/task',
      name: 'TaskManagement',
      component: () => import('../views/task/taskWaiting.vue'),
      meta: {
        title: '任务管理',
        keepAlive: true,
      },
    },
    {
      path: '/workflow/leave',
      name: 'LeaveManagement',
      component: () => import('../views/leave/index.vue'),
      meta: {
        title: '请假管理',
        keepAlive: true,
      },
    },
    {
      path: '/workflow/:pathMatch(.*)*',
      name: 'WorkflowNotFound',
      component: () => import('../views/NotFound.vue'),
    },
  ],
});

export default router;
